class Solution {
public:
    int findPeakElement(vector<int>& arr) {
        int sz=arr.size();
        int l=0;
        int r=sz-1;
        while(l<r)
        {
            int m=l+(r-l+1)/2;
            if(arr[m-1]<arr[m])
                l=m;
            else if(arr[m-1]>arr[m])
                r=m-1;
        }
        return r;
    }
};
